import { axios } from '@/utils/request'
import { mimeMap, resolveBlob } from '@/utils/download'

const api = {
  getList: '/system/payment_record/pageList',
  getMemberType: '/system/memberType/getDownList',
  exportList: '/system/payment_record/exportExcel',
  getDetail: '/system/payment_record/getInfo',

}

export default api

/**
  * 缴费记录列表
  */
export function getList(params) {
  return axios({
    url: api.getList,
    method: 'get',
    params
  })
}

/**
* 会员类型下拉
*/
export function getMemberType(params) {
  return axios({
    url: api.getMemberType,
    method: 'get',
    params
  })
}

/**
  * 导出
  */
export function exportList(params) {
  axios({
    url: api.exportList,
    method: 'get',
    params,
    responseType: 'blob',
    timeout: 0
  }).then(res => {
    resolveBlob(res, mimeMap.xlsx)
  })
}

/**
* 详情
*/
export function getDetail(data) {
  return axios({
    url: api.getDetail + '/' + data.id,
    method: 'get',
    data
  })
}